//============================================================================
// Name        : DevilScript.cpp
// Author      : 
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <fstream>
#include <unordered_map>
#include "DevilInterpreter.h"

using namespace std;

int main() {
	std::string home(getenv("HOME"));
	 
	CRefPtr< std::istream > ifs(new ifstream(home + "/output.ps", ifstream::in));
	DevilInterpreter di;

	int pageNo = 0;
	float scale = 1.33333f;
	di.setPostscript(ifs);
	
	SkBitmap bmp;
	di.renderPage(pageNo, scale, bmp);
	
	char output[256];
	sprintf(output, "/skia-page-%d.png", pageNo);
	std::string path = home + output;
	bool result = SkImageEncoder::EncodeFile(path.c_str(), bmp, SkImageEncoder::kPNG_Type, 100);
	
	return 0;
}
